<?php 
$sothu = $this->common_model->getnumber2('email',array('email_to'=>$this->session->userdata('email'),'status'=>1)); 
$id = $this->uri->segment(3);
?>
<style>
.main_email1{
	width:105%;
	height:420px;
    position:relative;
}
</style>
<div class="col_left">
    <div class="heading_right">Hộp thoại (<?php echo $sothu;?>)</div>
    <div class="body-right">
                <div class="main_email1">
                    <?php 
					if(!empty($email)){
						foreach ($email as $mail){
							$mail_info = $this->common_model->getone('users',array('email'=>$mail->email_from),array('id','avartar','name','type'));
							$img = explode(',',$mail_info->avartar);
                     ?>
                        <div class="email_list" <?php if($mail->status == 0) { echo ' style="height:60px;background:#f0f0f0";cursor:pointer;';} elseif($id == $mail->id){ echo ' style="height:60px;cursor:pointer;background-color:rgb(215,215,215)"';} else{echo ' style="height:60px;cursor:pointer;"';} ?> onclick="window.location='<?php echo base_url().'email/chi-tiet/'.$mail->id.'.html'; ?>';">
                            <div class="tutor_mess clearfix">
                            <a style="display: block;" class="clearfix">
                                <div class="rep_avartar">
                                    <img alt="" title="" src="<?php echo get_thumnails($img[0],50,50); ?>" width="50" height="50" />
                                </div>
                                <div class="info_mail">
                                    <h3 class="name_mail"><?php echo $mail_info->name; ?></h3>
                                    <div class="take_mss_tutor">
                                        <?php echo character_limiter($mail->description,100); ?>
                                    </div>
                                    <p class="date_sent"><?php echo $mail->date; ?></p>
                                </div>
                            </a>
                            </div>
                        </div>
					<?php 
						}
					} 
					?>
                </div>
    </div>
</div>